|
|
|
|
|
|
|
Chapter 16
Shading Models |
|
|
|
|
|
|
|
|
Chapter 15, Hidden Surface Removal, describes several different kinds of hidden surface removal algorithms. By removing hidden surfaces, you can make the display of three-dimensional objects easier to understand. |
|
|
|
|
|
|
|
|
The Valley example program described in Chapter 14, Surfaces, uses color to produce a fractal valley landscape. It uses blue for a river, white for snow, gray for steep cliffs, and different shades of green for vegetation. This technique makes the result much more realistic than a simple wire frame or even an image with hidden surfaces removed. |
|
|
|
|
|
|
|
|
You can make images even more realistic by using a shading model (sometimes called a lighting model). A shading model embodies some of the physics that determine how light falls on an object. By considering diffuse and specular reflection, ambient light, and the distance from the light source, you can shade objects realistically, making three-dimensional scenes more believable and easier to understand. |
|
|
|
|
|
|
|
|
The physical laws that describe how light interacts with an object are extremely complex. They involve such factors as the brightness of the light, whether the light comes from a point source or a bright surface, the wavelengths present in the light, the angle of incidence of the light on an object's surface, the roughness of the surface with respect to the wavelengths present in the light, and the amount of light reflected off other objects onto this one. |
|
|
|
|
|
|
|
|
Fortunately, to display an object on a computer you do not need to understand every last detail of the physics involved. Instead you can use a mathematical model that takes into account the most important aspects of the physical situation. The level of detail your model should have depends on your needs and your available processing power. To display a spinning cube in real time, you need a fairly simple model. Without an extremely powerful computer, your program cannot compute values for a complex shading model fast enough to display the results in real time. |
|
|
|
|
|